import Main from '@/components/main'
import parentView from '@/components/parent-view'

/**
 * iview-admin中meta除了原生参数外可配置的参数:
 * meta: {
 *  title: { String|Number|Function }
 *         显示在侧边栏、面包屑和标签栏的文字
 *         使用'{{ 多语言字段 }}'形式结合多语言使用，例子看多语言的路由配置;
 *         可以传入一个回调函数，参数是当前路由对象，例子看动态路由和带参路由
 *  hideInBread: (false) 设为true后此级路由将不会出现在面包屑中，示例看QQ群路由配置
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  notCache: (false) 设为true后页面在切换标签后不会缓存，如果需要缓存，无需设置这个字段，而且需要设置页面组件name属性和路由配置的name一致
 *  access: (null) 可访问该页面的权限数组，当前路由设置的权限会影响子路由
 *  icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标，如果是自定义图标，需要在图标名称前加下划线'_'
 *  beforeCloseName: (-) 设置该字段，则在关闭当前tab页时会去'@/router/before-close.js'里寻找该字段名对应的方法，作为关闭前的钩子函数
 *  folder 文件夹不可访问的路由 跳转至401页面
 * }
 */

export default [
  {
    path: '/',
    name: '_home',
    redirect: '/home',
    component: Main,
    meta: {
      hideInMenu: true
    },
    children: [
      {
        path: '/home',
        name: 'home',
        meta: {
          hideInMenu: true,
          title: '首页',
          icon: 'md-home'
        },
        component: () => import('@/view/single-page/home')
      }
    ]
  },
  {
    path: '/system',
    name: 'system',
    component: Main,
    meta: {
      title: '全局设置',
      icon: '_yewujichushezhi',
      hideInBread: true,
      folder: true,
      access: ['admin']
    },
    children: [
      {
        path: 'system-system',
        name: 'system-system',
        meta: {
          icon: '_quanjupeizhi',
          title: '全局设置',
          access: ['admin']
        },
        component: () => import('@/view/system/system/System.vue')
      }
    ]
  },
  {
    path: '/bug',
    name: 'bug',
    component: Main,
    meta: {
      title: 'Bug检测',
      icon: 'ios-bug',
      hideInBread: true,
      hideInMenu: true,
      folder: true,
      access: ['admin']
    },
    children: [
      {
        path: 'bug-bug',
        name: 'bug-bug',
        meta: {
          icon: 'ios-bug',
          title: 'Bug检测',
          access: ['admin']
        },
        component: () => import('@/view/bug/bug/Bug.vue')
      }
    ]
  },
  {
    path: '/setting',
    name: 'setting',
    component: Main,
    meta: {
      title: '基础设置',
      icon: '_yewujichushezhi',
      hideInBread: true,
      folder: true
    },
    children: [
      {
        path: 'setting-base',
        name: 'setting-base',
        meta: {
          icon: '_shezhi2',
          title: '参数设置'
        },
        component: () => import('@/view/setting/base/Base.vue')
      },
      {
        path: 'setting-staff',
        name: 'setting-staff',
        meta: {
          icon: '_yuangong',
          title: '管理员设置'
        },
        component: () => import('@/view/setting/manage/Manage.vue')
      },
      {
        path: 'setting-message',
        name: 'setting-message',
        meta: {
          icon: '_xiaoxi',
          title: '消息设置'
        },
        // component: () => import('@/view/setting/tpl/Tpl.vue')
        component: parentView,
        children: [
          {
            path: 'setting-message-tpl',
            name: 'setting-message-tpl',
            meta: {
              title: '模板消息'
            },
            component: () => import('@/view/setting/message/tpl/Tpl.vue')
          },
          {
            path: 'setting-message-sub',
            name: 'setting-message-sub',
            meta: {
              title: '订阅消息'
            },
            component: () => import('@/view/setting/message/sub/Sub.vue')
          }
          // {
          //   path: 'setting-message-sms',
          //   name: 'setting-message-sms',
          //   meta: {
          //     title: '短信设置'
          //   },
          //   component: () => import('@/view/setting/tpl/Tpl.vue')
          // }
        ]
      },
      {
        path: 'setting-red-access',
        name: 'setting-red-access',
        meta: {
          hideInMenu: true,
          title: '发红包权限'
        },
        component: () => import('@/view/setting/red-access/RedAccess.vue')
      }
    ]
  },
  {
    path: '/enter',
    name: 'enter',
    component: Main,
    meta: {
      hideInBread: true,
      folder: true
    },
    children: [
      {
        path: 'enter-enter',
        name: 'enter-enter',
        meta: {
          icon: '_rukou',
          title: '应用入口'
        },
        component: () => import('@/view/enter/Enter.vue'),
        children: [
          {
            path: 'enter-edit/:id',
            name: 'enter-edit',
            meta: {
              icon: '_rukou',
              title: '编辑入口'
            },
            component: () => import('@/view/enter/children/edit/Edit.vue')
          }
        ]
      }
    ]
  },
  {
    path: '/member',
    name: 'member',
    component: Main,
    meta: {
      hideInBread: true,
      folder: true
    },
    children: [
      {
        path: 'member-member',
        name: 'member-member',
        meta: {
          icon: '_huiyuan',
          title: '用户列表'
        },
        component: () => import('@/view/member/Member.vue')
      }
    ]
  },
  {
    path: '/red',
    name: 'red',
    component: Main,
    meta: {
      hideInBread: true,
      folder: true
    },
    children: [
      {
        path: 'red-red',
        name: 'red-red',
        meta: {
          icon: '_hongbao',
          title: '红包列表'
        },
        component: () => import('@/view/red/Red.vue')
      }
    ]
  },
  {
    path: '/media',
    name: 'media',
    component: Main,
    meta: {
      title: '素材库',
      icon: '_sucaiku',
      hideInBread: true,
      folder: true
    },
    children: [
      {
        path: 'media-setting',
        name: 'media-setting',
        meta: {
          icon: '_shezhi1',
          title: '素材库设置'
        },
        component: () => import('@/view/media/setting/Setting.vue')
      },
      {
        path: 'media-check',
        name: 'media-check',
        meta: {
          icon: '_gaojianshenhe',
          title: '素材审核'
        },
        component: () => import('@/view/media/check/Check.vue')
      }
    ]
  },
  {
    path: '/coupon',
    name: 'coupon',
    component: Main,
    meta: {
      hideInBread: true,
      folder: true
    },
    children: [
      {
        path: 'coupon-coupon',
        name: 'coupon-coupon',
        meta: {
          icon: '_icon-test',
          title: '卡券审核'
        },
        component: () => import('@/view/coupon/check/Check.vue')
      }
    ]
  },
  {
    path: '/finance',
    name: 'finance',
    component: Main,
    meta: {
      title: '财务管理',
      icon: '_caiwu',
      hideInBread: true,
      folder: true
    },
    children: [
      {
        path: 'finance-setting',
        name: 'finance-setting',
        meta: {
          icon: '_shezhi',
          title: '财务设置'
        },
        component: () => import('@/view/finance/setting/Setting.vue')
      },
      {
        path: 'finance-gain',
        name: 'finance-gain',
        meta: {
          icon: '_yingli',
          title: '盈利设置'
        },
        component: () => import('@/view/finance/gain/Gain.vue')
      },
      {
        path: 'finance-deposit',
        name: 'finance-deposit',
        meta: {
          icon: '_cash-out',
          title: '提现列表'
        },
        component: () => import('@/view/finance/deposit/Deposit.vue')
      }
    ]
  },
  {
    path: '/401',
    name: 'error_401',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/401.vue')
  },
  {
    path: '/500',
    name: 'error_500',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/500.vue')
  },
  {
    path: '*',
    name: 'error_404',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/404.vue')
  }
]
